package com.bwie.controller;

import com.bwie.pojo.Brand;
import com.bwie.service.BrandService;
import com.bwie.service.impl.BrandServiceImpl;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 品牌表(tb_brand)表控制层
 *
 * @author xxxxx
 */
@RestController
@RequestMapping("/brand/brand")
public class BrandController {
    /**
     * 服务对象
     */
    @Autowired
    private BrandService brandService;


    /**
     * @author: 鑫仔
     * @description: 品牌列表
     * @params: [com.bwie.vo.PageInfoVo]
     * @return: com.bwie.utils.R
     * @date: 2025/7/19 10:03
     */
    @PostMapping("brandList")
    public R brandList(
            @RequestBody PageInfoVo pageInfoVo
    ) {
        return brandService.brandList(pageInfoVo);
    }

    /**
     * @author: 鑫仔
     * @description: 添加品牌
     * @params: [com.bwie.pojo.Brand]
     * @return: com.bwie.utils.R
     * @date: 2025/7/20 18:51
     */
    @PostMapping("addBrand")
    public R addBrand(
            @RequestBody Brand brand
    ) {
        return brandService.addBrand(brand);
    }

    /**
     * @author: 鑫仔
     * @description: 修改状态
     * @params: [com.bwie.pojo.Brand]
     * @return: com.bwie.utils.R
     * @date: 2025/7/20 19:43
     */
    @PostMapping("updateStatus")
    public R updateStatus(
            @RequestBody Brand brand
    ) {
        return brandService.updateStatus(brand);
    }

    /**
     * @author: 鑫仔
     * @description: 批量删除
     * @params: [java.util.List<java.lang.Integer>]
     * @return: com.bwie.utils.R
     * @date: 2025/7/21 9:37
     */
    @PostMapping("deleteBatchBrand")
    public R deleteBatchBrand(
            @RequestBody List<Integer> ids
    ) {
        return brandService.deleteBatchBrand(ids);
    }

}
